﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;

namespace Aphysoft.Vate.Editor
{
    public class ServiceProvider : IServiceProvider
    {
        #region Properties

        private Dictionary<Type, object> services;

        #endregion

        #region Methods
        /// <summary>
        /// Adds a new service to the collection.
        /// </summary>
        public void AddService<T>(T service)
        {
            services.Add(typeof(T), service);
        }
        /// <summary>
        /// Looks up the specified service.
        /// </summary>
        public object GetService(Type serviceType)
        {
            object service;

            services.TryGetValue(serviceType, out service);

            return service;
        }
        #endregion

        #region Constructor

        public ServiceProvider()
        {
            services = new Dictionary<Type, object>();
        }

        #endregion
    }
}
